1. Field of the Invention
The present invention relates to a numerical controller that performs machining by creating a curve for machining (machining curve) based on a command point sequence obtained from a machining program for a machine tool having a plurality of drive axes including at least two linear axes, interpolating the machining curve, and driving the drive axes to the interpolated positions on the machining curve.
2. Description of the Related Art
Conventionally, with a numerical controller that controls a machine tool, a method of creating a curve or a straight line from a supplied point sequence and interpolating the curve or the straight line is known.
<1> Curve Creation
1-1. A spline curve when a starting point condition at a starting point and an ending point condition at an ending point of a command point sequence are specified
Generally, when a point sequence P0, P1, P2, . . . , Pn, a first-derivative vector P0′ as a starting point condition at a starting point of the point sequence, and a first-derivative vector Pn′ as an ending point condition of an ending point of the point sequence are given as shown in FIG. 1, a cubic function representing a cubic curve connecting the respective points so that first-derivative vectors and second-derivative vectors at each point are continuous is obtained as follows.
Expression (1) below holds for first-derivative vectors (P0′, P1′, P2′, . . . , Pn′)T at the respective points, where “T” denotes transposition. However, hereinafter, the sign will be omitted whenever self-evident. t1, t2, . . . , tn denote differences in values of parameters (cubic function parameters t) of a created cubic function between the respective points P0, P1, P2, . . . , Pn and is generally expressed as distances (curve lengths) between the respective points P0, P1, P2, . . . , Pn of the created cubic function. However, a cubic function cannot be determined unless P0′, P1′, P2′, . . . , Pn′ are determined, and the distances (curve lengths) between the respective points P0, P1 P2, . . . , Pn of a curve representing a cubic function cannot be determined unless the cubic function is determined. Therefore, the distances (curve lengths) between the respective points P0, P1, P2, . . . Pn are often approximated by linear distances between the respective points P0, P1, P2, . . . , Pn. For example, a linear distance between P0 and P1 is denoted by t1, a linear distance between P1 and P2 is denoted by t2, . . . , and a linear distance between Pn-1 and Pn is denoted by tn. Moreover, a first-derivative vector and a second-derivative vector respectively refer to values at each point (values of parameter t at each point) of a first-order differentiation and a second-order differentiation of a cubic function by the parameter t.
In this case, P0, P1, P2, . . . , Pn and P0′, P1′, P2′, . . . , Pn′ are vectors having elements corresponding to at least two linear axes. Depending on machine construction, the vectors may have elements of third, fourth, . . . linear axes or elements of rotational axes in addition to the two linear axes.
                                          [                                                            1                                                  0                                                  …                                                  …                                                  …                                                  …                                                  0                                                                                                  t                    2                                                                                        2                    ⁢                                          (                                                                        t                          1                                                +                                                  t                          2                                                                    )                                                                                                            t                    1                                                                    0                                                  …                                                  …                                                  0                                                                              0                                                                      t                    3                                                                                        2                    ⁢                                          (                                                                        t                          2                                                +                                                  t                          3                                                                    )                                                                                                            t                    2                                                                    0                                                  …                                                  0                                                                              …                                                  …                                                  …                                                  …                                                  …                                                  …                                                  …                                                                              0                                                  …                                                  …                                                  0                                                                      t                    n                                                                                        2                    ⁢                                          (                                                                        t                                                      n                            -                            1                                                                          +                                                  t                          n                                                                    )                                                                                                            t                                          n                      -                      1                                                                                                                    0                                                  …                                                  …                                                  …                                                  …                                                  0                                                  1                                                      ]                    ⁡                      [                                                                                P                    0                    ′                                                                                                                    P                    1                    ′                                                                                                                    P                    2                    ′                                                                                                …                                                                                                  P                                          n                      -                      1                                        ′                                                                                                                    P                    n                    ′                                                                        ]                          =                  [                                                                      P                  0                  ′                                                                                                                          3                                                                  t                        1                                            ⁢                                              t                        2                                                                              ⁢                                      (                                                                                            t                          1                          2                                                ⁡                                                  (                                                                                    P                              2                                                        -                                                          P                              1                                                                                )                                                                    +                                                                        t                          2                          2                                                ⁡                                                  (                                                                                    P                              1                                                        -                                                          P                              0                                                                                )                                                                                      )                                                                                                                                            3                                                                  t                        2                                            ⁢                                              t                        3                                                                              ⁢                                      (                                                                                            t                          2                          2                                                ⁡                                                  (                                                                                    P                              3                                                        -                                                          P                              2                                                                                )                                                                    +                                                                        t                          3                          2                                                ⁡                                                  (                                                                                    P                              2                                                        -                                                          P                              1                                                                                )                                                                                      )                                                                                                      …                                                                                                          3                                                                  t                                                  n                          -                          1                                                                    ⁢                                              t                        n                                                                              ⁢                                      (                                                                                            t                                                      n                            -                            1                                                    2                                                ⁡                                                  (                                                                                    P                              n                                                        -                                                          P                                                              n                                -                                1                                                                                                              )                                                                    +                                                                        t                          n                          2                                                ⁡                                                  (                                                                                    P                                                              n                                -                                1                                                                                      -                                                          P                                                              n                                -                                2                                                                                                              )                                                                                      )                                                                                                                        P                  n                  ′                                                              ]                                    (        1        )            
Therefore, since P0′, Pn′, P0, P1, P2, . . . , Pn are given by Expression (1) above and t1, t2, . . . , tn can be derived from P0, P1, P2, . . . , Pn, P′=(P0′, P1′, P2′, . . . , Pn′)T can be determined. In other words, if Expression (1) is represented by Expression (2) below, then P′ can be determined as represented by Expression (3).M*P′=B  (2)P′=M−1*B  (3)
Once P′ can be determined, a function of a cubic curve between the respective points can be derived from P0, P1, P2, . . . , Pn. In other words, a function fi(t) (i=0, 1, 2, . . . , n-1; 0≦t≦ti+1) of a cubic curve between Pi and Pi+1 which is expressed as represented by Expression (4) below can be derived from Pi, Pi+1, Pi′, Pi+1′. Therefore, from command point sequence positions (P0, P1, P2, . . . , Pn), a starting point condition (in this case, P0′), and an ending point condition (in this case, Pn′), a function representing a cubic curve between the respective points such that first-derivative vectors and second-derivative vectors at each point are continuous can be derived. Afi, Bfi, Cfi, Dfi are coefficients of the function fi(t). The coefficients and the function fi(t) are vectors having elements corresponding to the number of axes in a similar manner to P0, P1, P2, . . . , Pn.fi(t)=Afi*t3+Bfi*t2+Cfi*t+Dfi  (4)
fi(t) may be determined as follows. When fi(t) is expressed as represented by Expression (4) above, fi′(t) may be expressed as represented by Expression (5) below. Therefore, Expression (6) holds, and by solving Expression (6) to derive Afi, Bfi, Cfi, and Dfi, the function fi(t) can be determined.fi′(t)=3*Afi*t2+2*Bfi*t+Cfi  (5)fi(0)=Dfi=Pi fi(ti+1)=Afi*ti+13+Bfi*ti+12+Cfi*ti+1+Dfi=Pi+1 fi′(0)=Cfi=Pi′fi′(ti+1)=3*Afi*ti+12+2*Bfi*ti+1+Cfi=Pi+1′  (6)
A group of cubic curves determined in this manner is referred to as a spline curve. Since first-derivative vectors and second-derivative vectors at each point of a spline curve are continuous, a smooth machining shape and a smooth operation with continuous acceleration of each drive axis are obtained.
However, this method requires calculations be performed by reading in all command point sequence positions (P0, P1, P2, . . . , Pn). As the number of points constituting the command point sequence increases, the scale of matrix calculation becomes enormous and necessitates a large memory region and a long computation time.
Moreover, while a condition that P0′ and Pn′ are specified has been adopted above, it is known that an expression approximately similar to Expression (1) above may be derived by adopting the following conditions. As described above, a condition at P0 is referred to as a starting point condition and a condition at Pn is referred to as an ending point condition.                Second-derivative vectors at P0 and Pn are 0. That is, P0″=0 and Pn″=0.        P0′ is specified, and Pn″=0.        Let P0″=0, and Pn′ is specified.        
Therefore, even when conditions such as given above are adopted, a function fi(t) (i=0, 1, 2, . . . , n−1; 0≦t≦ti+1) of a cubic curve between Pi and Pi+1 can be determined in an approximately similar manner.
1-2. Creating a curve of a cubic function that sequentially connects points constituting a command point sequence
A method disclosed in Japanese Patent Application Laid-open No. 2-113305 (corresponding to U.S. Pat. No. 5,140,236) is a method of sequentially determining cubic expressions between points by deriving a first-derivative vector from a predetermined number of points including a starting point, deriving a cubic expression between the starting point and a next point based on coordinate values of predetermined points including the starting point, an end-point condition of the starting point, and the first-derivative vector, determining a spline curve between the starting point and a point subsequent to the starting point, and adding a new next point in place of the starting point. According to this method, a cubic spline curve is created without having to read in all points constituting a command point sequence. Although this method is advantageous in that a practically acceptable spline curve can be obtained by sequentially reading in points that constitute a command point sequence without increasing error from the theoretical spline curve described in “<1> Curve creation, 1-1” above, the method is problematic in that
(a) since a cubic spline curve is sequentially created between points while reading in points that constitute a command point sequence, if intervals between the points are small, a capacity of a numerical controller for creating and interpolating a cubic spline curve becomes insufficient and the numerical controller decelerates movements of axes, and
(b) if positions of the command point sequence are varied due to error with respect to a target curve, the created curve ends up being similarly varied.
<2> Thinning Out
Japanese Patent Application Laid-open No. 10-49215 discloses a method of performing straight-line approximation on a command point sequence and thinning-out points that correspond to approximated points. This method is problematic in that, since the command point sequence is approximated by a straight line, the approximated point sequence does not have a smooth shape.
<3> Correcting Command Point Positions
Japanese Patent Application Laid-open No. 10-240328 discloses a method of correcting positions of command points within a range of a permissible value so that the command points line up in a smooth manner. With this method, when a point sequence having small intervals between command points is commanded, processing capacity may become insufficient and deceleration may occur. Since the method of correcting command point positions involves creating an curve for approximation from several consecutive points (for example, five points) and correcting command point positions toward the curve, when positions of a command point sequence that is an approximated curve creation object have similar errors with respect to a target curve such as shown in FIG. 3, a correction that approximates the target curve cannot be performed due to the effect of the errors. In FIG. 3, tips of arrows depicting respective created curves indicate corrected positions of a command point sequence.